<?php

class Home extends Controller {
    public function __construct()
    {
        parent::__construct();
        $this->_data = array();
        isController('login');
    }

    public function index() {
    	$array = $this->uri->uri_to_assoc ( 3, array ('page' ) );
    	
        if (!isLogged())
            redirect('myuser/login');

        //List Online    
        $this->load->module_model('myuser','user_model');
        
        $listOnline = $this->user_model->getListUserOnline();
        $this->_data['listOnline'] = $listOnline;
        
        //List Reg Hari ini
        $this->load->module_model('klinik','registrasi_model');
        
        $where = array();
        $where['rmTglMulai'] = date('Y-m-d');
        $total = $this->registrasi_model->getCount($where);
        
        $this->load->library('pagination');
        if (($array['page'] + 1) > $total)
            $array['page'] = 0;
        $limit = $this->config->item('klinik_limit');
        $config = $this->config->item('paging');
        $config['base_url'] = site_url('klinik/registrasi/view/page/');
        $config['uri_segment'] = 4;
        $config['total_rows'] = $total;
        $config['per_page'] = $limit;
        
        $this->pagination->initialize($config);
        $this->_data['paging'] =  $this->pagination->create_links();
        
        $dataView = $this->registrasi_model->getList($where, $limit, $array['page']);
        $this->_data['dataView'] = $dataView;

        $this->_data['uri_to_assoc'] = $array;
        $this->load->view('home',$this->_data);
    }
    
    
   
}
